Repository navigation
fix(build): clean dist on build — eliminate flaky local test runs - #31
Merged
Merged
Conversation
…aky tests) The test flake (drifting counts, sporadic file-level 'not ok' with no failing subtests) was a dirty dist/, not a concurrency race. 'build' never cleaned dist/, so stale compiled output from renamed/deleted sources plus sync conflict copies (* 2.ts/* 3.ts → dist/* [0-9].js) lingered and the test glob ran them as duplicate/divergent tests. Now 'build' rm -rf dist first (like build:prod), and the tsconfig exclude covers * [0-9].ts/.tsx (was * 2.ts only). Verified stable: 16 consecutive runs at 2355 tests / 0 fail.
|
✅ Docker image built successfully
|
9 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause (investigated, not guessed)
Local
npm testruns were flaky: the test count drifted (2355 → 2359 → 2361 across runs) with sporadic file-level "not ok" and zero failing subtests. This was previously assumed to be amigration-runnerconcurrency race; it is not.Systematic debugging isolated it to a dirty
dist/:build(unlikebuild:prod) never ranrm -rf dist, so compiled.jsfrom deleted/renamed sources accumulated (found 1244 orphan files locally).foo 2.ts,foo 3.ts, …) compiled todist/foo [0-9].js; the tsconfig exclude only covered* 2.ts.testglobdist/*.test.jsthen ran those orphans as duplicate/divergent tests → nondeterministic counts and intermittent failures.Proof: removing the junk + clean rebuild gave 16 consecutive runs at a stable 2355 tests / 0 failures (before: drift + occasional 1 fail). CI was already immune (fresh clone +
build:prodcleans dist), which is why this only bit local runs.Fix
buildnowrm -rf distbeforetsc(matchesbuild:prod) → every run tests only current sources.* 2.ts→* [0-9].ts/* [0-9].tsx(covers3/4copies too).No source/behavior changes — build hygiene only.
Verify
npm run build && npm test→ junk=0, 132 test files, 2355 tests, 0 fail (stable across 16 runs).🤖 Generated with Claude Code